import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Req,
  Query,
} from '@nestjs/common';

import { MessageService } from './message.service';
import { ApiTags } from '@nestjs/swagger';
import { AdminMessagePageReqDto } from './dto/admin-message.dto';
@ApiTags('后台/留言')
@Controller('admin/message')
export class AdminMessageController {
  constructor(private readonly messageService: MessageService) {}

  /**
   * 留言列表
   */
  @Get()
  messageList(@Query() query: AdminMessagePageReqDto) {
    return this.messageService.findAllForPage(query);
  }

  /**
   * 留言详情
   */
  @Get(':messageId')
  messageDetail(@Param('messageId') messageId: number) {
    return this.messageService.findOne(messageId);
  }

  /**
   * 删除留言
   */
  @Delete(':messageId')
  async remove(@Param('messageId') messageId: number) {
    await this.messageService.fakeRemove(messageId);
  }

  /**
   * 回复留言
   */
  // @Patch(':messageId')
  // async reply(
  //   @Param('messageId') messageId: number,
  // ) {
  //   await this.messageService.reply(messageId, reply);
  // }
}
